home *** CD-ROM | disk | FTP | other *** search
/ Kit PC World De Ampliacion De Windows 95 / Kit PC World de ampliacion de Windows 95.iso / internet / sweeper / samples / olecon~1 / controls / webbit~1 / webbit~1.h < prev    next >
C/C++ Source or Header  |  1995-12-05  |  5KB  |  157 lines

  1. //=--------------------------------------------------------------------------=
  2. // WebBitmapCtl.H
  3. //=--------------------------------------------------------------------------=
  4. // Copyright  1995  Microsoft Corporation.  All Rights Reserved.
  5. //
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
  7. // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
  8. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
  9. // PARTICULAR PURPOSE.
  10. //=--------------------------------------------------------------------------=
  11. //
  12. // class declaration for the WebBitmap control.
  13. //
  14. #ifndef _WEBBITMAPCONTROL_H_
  15.  
  16. #include "IPServer.H"
  17. #include "CtrlObj.H"
  18. #include "Internet.h"
  19. #include "WebBitmapInterfaces.H"
  20. #include "Dispids.H"
  21.  
  22.  
  23. #include "DibClasses.H"
  24.  
  25. typedef struct tagWEBBITMAPCTLSTATE {
  26.  
  27.     // TOOD: put state variables here, and probably get rid of fGarbage, unless
  28.     // you have a real need for it
  29.     //
  30.     VARIANT_BOOL fGarbage;
  31.  
  32. } WEBBITMAPCTLSTATE;
  33.  
  34. //=--------------------------------------------------------------------------=
  35. // CWebBitmapControl
  36. //=--------------------------------------------------------------------------=
  37. // our control.
  38. //
  39. class CWebBitmapControl :    public CInternetControl, 
  40.                                     public IWebBitmap, 
  41.                                     public ISupportErrorInfo {
  42.  
  43.   public:
  44.     // IUnknown methods
  45.     //
  46.     DECLARE_STANDARD_UNKNOWN();
  47.  
  48.     // IDispatch methods
  49.     //
  50.     DECLARE_STANDARD_DISPATCH();
  51.  
  52.     // ISupportErrorInfo methods
  53.     //
  54.     DECLARE_STANDARD_SUPPORTERRORINFO();
  55.  
  56.     // IWebBitmap methods
  57.     //
  58.     // TODO: copy over the method declarations from WebBitmapInterfaces.H
  59.     //       don't forget to remove the PURE from them.
  60.     //
  61.     STDMETHOD(get_ReadyState)(THIS_ long FAR* thestate);
  62.     STDMETHOD(get_Bitmap)(THIS_ OLE_DATAPATH FAR* path) ;
  63.     STDMETHOD(put_Bitmap)(THIS_ OLE_DATAPATH path) ;
  64.     STDMETHOD_(void, AboutBox)(THIS) ;
  65.     STDMETHOD(Scramble)(THIS) ;
  66.  
  67.     // OLE Control stuff follows:
  68.     //
  69.     CWebBitmapControl(IUnknown *pUnkOuter);
  70.     virtual ~CWebBitmapControl();
  71.  
  72.     // static creation function.  all controls must have one of these!
  73.     //
  74.     static IUnknown *Create(IUnknown *);
  75.  
  76.   private:
  77.     // overridables that the control must implement.
  78.     //
  79.     STDMETHOD(LoadBinaryState)(IStream *pStream);
  80.     STDMETHOD(SaveBinaryState)(IStream *pStream);
  81.     STDMETHOD(LoadTextState)(IPropertyBag *pPropertyBag, IErrorLog *pErrorLog);
  82.     STDMETHOD(SaveTextState)(IPropertyBag *pPropertyBag, BOOL fWriteDefault);
  83.     STDMETHOD(OnDraw)(HDC hdcDraw, LPCRECTL prcBounds, LPCRECTL prcWBounds, HDC hicTargetDev);
  84.     virtual LRESULT WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  85.     virtual BOOL    RegisterClassData(void);
  86.  
  87.     virtual HRESULT InternalQueryInterface(REFIID, void **);
  88.     virtual void    BeforeCreateWindow(void);
  89.     
  90.     virtual void    AfterCreateWindow(void);
  91.  
  92.     //    Internet specific callbacks:
  93.     //
  94.     ///    OnData is called asynchronously as data for an object or property arrives...
  95.     virtual HRESULT OnData( DISPID id, DWORD grfBSCF,IStream * bitstrm, DWORD amount );
  96.  
  97.     //    OnProgess is called to allow you to present progess indication UI
  98.     virtual HRESULT OnProgress( DISPID, ULONG progress, ULONG themax, ULONG, LPCWSTR);
  99.  
  100.  
  101.     // private state information.
  102.     //
  103.  
  104.     HRESULT SetBmpPath(const char *psz);
  105.     HRESULT SetBmpPath(IStream *);
  106.     HRESULT UpdateBitmap();
  107.  
  108.     enum bmpDownloadStates
  109.     {
  110.         bdsNoBitsYet,
  111.         bdsGotFileHeader,
  112.         bdsGotBitmapInfo,
  113.         bdsGettingBits,
  114.         bdsBitsAreDone
  115.     };
  116.  
  117.  
  118.     HDC                    m_dc;
  119.     bmpDownloadStates    m_state;
  120.     DWORD                m_oldSize;
  121.     CDibFile *            m_dibFile;
  122.     CDibSection *        m_dib;
  123.  
  124.     // Actual properties
  125.     char *                m_bmpPath;
  126.  
  127. };
  128.  
  129.  
  130. // TODO: if you have an array of verbs, then add an extern here with the name
  131. //       of it, so that you can include it in the DEFINE_CONTROLOBJECT.
  132. //       ie.  extern VERBINFO m_WebBitmapCustomVerbs [];
  133. //
  134. extern const GUID    *rgWebBitmapPropPages [];
  135. DEFINE_CONTROLOBJECT(WebBitmap,
  136.     &CLSID_WebBitmap,
  137.     "WebBitmapCtl",
  138.     CWebBitmapControl::Create,
  139.     1,
  140.     &IID_IWebBitmap,
  141.     "WebBitmap.HLP",
  142.     &DIID_DWebBitmapEvents,
  143.     OLEMISC_SETCLIENTSITEFIRST|OLEMISC_ACTIVATEWHENVISIBLE|OLEMISC_RECOMPOSEONRESIZE|OLEMISC_CANTLINKINSIDE|OLEMISC_INSIDEOUT,
  144.     RESID_TOOLBOX_BITMAP,
  145.     "WebBitmapWndClass",
  146.     1,
  147.     rgWebBitmapPropPages,
  148.     0,
  149.     NULL);
  150.  
  151.  
  152.  
  153. #define _WEBBITMAPCONTROL_H_
  154. #endif // _WEBBITMAPCONTROL_H_
  155.  
  156.  
  157.